package wj.tree.functions;

import java.util.ArrayList;

import wj.WJValue;
import wj.tree.WJNode;

public class ConnectNode implements WJNode {

	private ArrayList<WJNode> toConnect;
	
	public ConnectNode(){
		toConnect = new ArrayList<WJNode>();
	}
	
	public void addNodeToConnect(WJNode node){
		if(node != null)
			toConnect.add(node);
	}
	
	@Override
	public WJValue evaluate() {
		StringBuilder result = new StringBuilder();
		
		for(WJNode node: toConnect)
			result.append(node.evaluate().toString());
		
		return new WJValue(result.toString());
	}

}
